﻿using ExcelConfig;
using SynologyDotNet;
using SynologyLIB;
using System;

namespace syno_exec.csm.cmd
{
    public class InfoCmd
    {
        public static async Task<string[]> ReadShares()
        {
            using (var client = new SynoClient(new Uri(cgsys.config.Text("群晖地址")), true))
            {
                var syno = new MySyno(client);

                await syno.LoginAsync(cgsys.config.Text("群晖用户名"), cgsys.config.Text("群晖密码"));

                var shareds = await syno.ListShareFolder();
                if (shareds.Success)
                    return shareds.Data.Shares.Select(t => t.Name).ToArray();

                return Array.Empty<string>();
            }
        }

    }
}
